package com.spddr.pmos.cxf;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

import com.spddr.pmos.jpa.Role;
import com.spddr.pmos.jpa.User;

import cn.seqdata.cxf.repos.JaxrsObjectRepository;

@Path("/user")
public interface JaxrsUser extends JaxrsObjectRepository<User> {
	@PUT
	@Path("/")
	default <S extends User> S save(S entity) {
		return getRepository().save(entity);
	}

	@GET
	@Path("/{id}/roles")
	List<Role> findRoles(@PathParam("id") long id);

	@PUT
	@Path("/{id}/roles")
	List<Role> saveRoles(@PathParam("id") long id, List<Role> roles);

	@DELETE
	@Path("/{id}/roles")
	void deleteRoles(@PathParam("id") long id);
}
